package com.smartStatus.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smartStatus.admin.mapper.SysDictMapper;
import com.smartStatus.admin.service.SysDictService;
import com.smartStatus.api.entity.SysDict;
import com.smartStatus.core.util.R;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

/**
 * @ClassName : SysDictServiceImpl
 * @Author : lby
 * @Date: 2020/12/16 14:39
 * @Description :
 */
@Service
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService {
    @Override
    public IPage<SysDict> pageDicts(IPage<SysDict> page, QueryWrapper<SysDict> queryWrapper, @Param("sysDict") SysDict sysDict) {
        return baseMapper.pageDicts(page, queryWrapper, sysDict);
    }

    @Override
    public Boolean saveDict(SysDict sysDict) {
        return baseMapper.saveDict(sysDict);
    }

    @Override
    public Boolean editDict(SysDict sysDict) {
        return baseMapper.editDict(sysDict);
    }

    @Override
    public Boolean delDict(SysDict sysDict) {
        return baseMapper.delDict(sysDict);
    }

    @Override
    public R getDictPage(Page<SysDict> page, SysDict sysDict) {
        QueryWrapper<SysDict> sysDictQuery = Wrappers.query();
        return R.ok(this.page(page,sysDictQuery));
    }
}
